package com.food.eat.impl;

import com.food.eat.mapper.CarouselMapper;
import com.food.eat.pojo.Carousel;
import com.food.eat.service.CarouselService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author:RenPu
 * @Date: 2020/7/20 17:22
 * @Version: 1.0
 * @description:
 */

@Service
public class CarouselServiceImpl implements CarouselService {


    @Resource
    private CarouselMapper carouselMapper;

    @Transactional(propagation = Propagation.SUPPORTS)
    @Override
    public List<Carousel> queryAllPicture(Integer standard) {

        Example example = new Example(Carousel.class);
        example.orderBy("sort");
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("isShow", standard);
        List<Carousel> carousels = carouselMapper.selectByExample(example);
        return carousels;
    }
}
